#!/bin/bash
ip=10.62.46.172

num=0
while true
do
    ping -c 1 -i 0.2 $ip > /dev/null 2>&1
                if [ "$?" -eq 0 ];then
                        let num++
                        echo $num
                        sleep 1
                else
                        sleep 1
                        let num=0
                        echo 0
                        continue
      fi
done
